<template>
  <main-comp :alternate="alternate" v-if="show" >
    <div class="m-mail-close" :style="mailAni">
      <div class="button" @click="handleClick"><img src="../assets/mail_button.png" /></div>
      <div class="title" :style="animation('fadeIn', 1, 1.5, 2.3)"><img src="../assets/1/title.png" /></div>
      <div class="logo" :style="animation('fadeIn', 1, 0.6, 2.3)"><img src="../assets/logo.png" /></div>
      <div class="point" :style="animation('scaleFade', 'infinite', 2, 4)"></div>
    </div>
  </main-comp>
</template>

<script>
/* eslint-disable */
import mainComp from '../comps/main-comp'
import { mapState } from 'vuex'
import video from '../utils/video'

export default {
  components: {
    mainComp
  },
  data() {
    return {
      alternate: false,
      tip: false,
      show: true
    }
  },
  computed: {
    mailAni() {
      return this.alternate ? this.animation('fadeOut', 1, 1.1, 0) : this.animation('fadeIn', 1, 0.6, 0.6)
    },
    pointAni() {
      return this.tip ? this.animation('zoomFadeInOut', 'infinite', 2, 0) : this.animation('fadeIn', 1, 0.6, 3.9)
    }
  },
  mounted() {
    setTimeout(() => {
      this.tip = true
    }, 3500)
  },
  methods: {
    handleClick() {
      console.log('====')
      video.play()
      video.pause()
      this.show = false
      this.$nextTick(() => {
        this.show = true
        this.alternate = true
        setTimeout(() => {
          this.$store.dispatch('nextScene')
        }, 1000)
      })
    }
  }
}
</script>

<style scoped>
.m-mail-close {
  background: url('../assets/mail_close.png') no-repeat;
  background-size: 100% 100%;
  position: absolute;
  width: 7.38rem;
  height: 10.08rem; 
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}
.m-mail-close .button {
  width: 1.5rem;
  height: 1.52rem;
  margin-top: 0.76rem;
  margin-left: 2.86rem;
}
.m-mail-close .title {
  width: 5.46rem;
  height: 2.32rem;
  margin-top: 0.7rem;
  margin-left: 0.83rem;
}
.m-mail-close .logo {
  width: 3.4rem;
  height: 0.47rem;
  margin-top: 3.12rem;
  margin-left: 2.19rem;
}
.m-mail-close img {
  width: 100%;
  height: 100%;
  display: block;
}
.m-mail-close .point {
  position: absolute;
  width: 0.6rem;
  height: 0.6rem;
  z-index: 2;
  border-radius: 0.3rem;
  border: 0.1rem solid #fff;
  left: 3.2rem;
  top: 1.2rem;
  pointer-events: none;
  -webkit-pointer-events: none;
}
</style>
